package com.someok.service.blogger;

import org.apache.log4j.Logger;

import com.someok.base.Config;
import com.someok.utils.template.TemplateContext;
import com.someok.utils.template.TemplateUtil;

public class CommentService {
	private static Logger log = Logger.getLogger(CommentService.class);
	private static Config conf = Config.getInstance();

	public String showComment(String blogItemID) {
		/*try {
			Thread.sleep(2000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}*/
		log.debug(conf.getString("service.comments.form"));

		TemplateContext ctx = new TemplateContext();
		ctx.put("formId", blogItemID);

		// default is 'service/blog/comment.vm'
		String templateName = conf.getString("service.comments.form");
		log.debug("Current template : " + templateName);

		return TemplateUtil.merge(ctx, templateName);
	}

	public String insertComment(Comment comment) {

		System.out.println("--" + comment);
		return comment.toString();
	}
}
